<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="/layout/layout.xhtml">

	<ui:define name="content">
		<h:form id="form">
			<p:panel id="panelInfosReunion" header="#{nouvelleReunionControler.labelPage}">
				<h:panelGrid columns="3" cellpadding="1" columnClasses="label, input, message">
					
					<h:outputLabel for="date" value="Date" />
					<p:calendar id="date"
						value="#{nouvelleReunionControler.reunion.date}"
						showOn="button" pattern="dd/MM/yyyy" mindate="01/01/1950"
						popIconOnly="true" locale="fr" showButtonPanel="true" />
					<p:message for="date" />
								        
			        <h:outputLabel for="hotesse" value="Hotesse" />
					<h:panelGroup id="panelGroupHotesse">
						<h:outputText id="hotesse"
							value="#{nouvelleReunionControler.reunion.hotesse.prenom} #{nouvelleReunionControler.reunion.hotesse.nom} - " />

						<p:commandLink style="color:blue" value="Choisir" onclick="choisirHotesseDialog.show()" />
					</h:panelGroup>
					
			        <p:message for="hotesse" />
					
					<h:outputLabel for="ca" value="Chiffre d'affaire" />
					<h:inputText id="ca"
						value="#{nouvelleReunionControler.reunion.chiffreAffaire}"
						label="Chiffre d'affaire">
					</h:inputText>
					<p:message for="ca" />

				</h:panelGrid>
			</p:panel>
			
			<p:dialog header="Selectionner l'hotesse"
				widgetVar="choisirHotesseDialog" resizable="false">
				<p:dataTable id="tablehotesses" var="hotesse" rows="15"  rowKey="#{hotesse.id}"
					value="#{listeHotesseControler.hotesses}"
					selection="#{nouvelleReunionControler.selectedHotesse}"
					paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
					paginator="true"
					emptyMessage="Pas d'hotesse avec ces critères de recherche">
		
					<p:column selectionMode="single" />
		
					<p:column filterBy="#{hotesse.nom}" headerText="Nom">
						<f:facet name="header">
							<h:outputText value="Nom" />
						</f:facet>
						<h:outputText value="#{hotesse.nom} #{hotesse.prenom}" />
					</p:column>
		
					<f:facet name="footer" style="text-align: center">
						<p:commandButton value="Selectionner"
							actionListener="#{nouvelleReunionControler.selectionnerHotesseListener}"
							oncomplete="choisirHotesseDialog.hide();" update=":form:panelInfosReunion"/>
						<p:commandButton value="Annuler" ajax="false" immediate="true" />
					</f:facet>
				</p:dataTable>
			</p:dialog>
			
			<p:panel style="text-align: center">
				<p:commandButton
					action="#{nouvelleReunionControler.ajouterReunion}"
					value="Valider" ajax="false" />
				<p:commandButton action="#{nouvelleReunionControler.annuler}"
					value="Annuler" ajax="false" immediate="true"
					style="margin-left:5px" />
			</p:panel>

		</h:form>
		
	</ui:define>
</ui:composition>